<template>
  <div class="main-right">
    <div class="Shuffling_figure-kut">
      <div class="youcetu" v-if="show">
        <img src="../../../assets/images/youce.png" alt="" />
        <span>Hi， 上午好</span>
        <p>登录大众点评，发现品质生活</p>
        <div class="dt">
          <!-- 声明式导航 -->
          <router-link to="/login">登录</router-link>
        </div>
        <div class="dd">
          <router-link to="/register">注册</router-link>
        </div>
      </div>

      <div class="youcetu" v-else>
        <img src="@/assets/images/headpic.jpg" alt="" />
        <span> Hi~,{{ userName }}</span>
        <p>您已经使用大众点评<span style="color: red"> 2143</span>天</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Logininfo",
  data() {
    return {
      show: true,
    };
  },
  mounted() {
    this.isShow();
  },
  computed: {
    //用户名
    userName() {
      return JSON.parse(localStorage.getItem("isLogin"));
    },
    // 中介
  },
  methods: {
    isShow() {
      let username = JSON.parse(window.localStorage.getItem("isLogin"));
      if (username) {
        this.show = false;
      } else {
        this.show = true;
      }
    },
  },
};
</script>

<style>
.main-right .main-right-top {
  border: 1px solid #e4e4e4;
}
.main-right {
  width: 200px;
  height: 510px;
  border: 1px solid #e4e4e4;
  margin-top: 20px;
  float: right;
  margin: 0 auto;
}

.main-right .Shuffling_figure-kut .youcetu img {
  width: 60px;
  height: 60px;
  margin: 20px 60px 0 60px;
  border-radius: 50%;
}

.Shuffling_figure-kut {
  line-height: 20px;
  text-align: center;
}

.main-right .Shuffling_figure-kut .youcetu .dt {
  width: 70px;
  height: 25px;
  float: left;
  margin-left: 20px;
  line-height: 25px;
  background-color: tomato;
}

.main-right .Shuffling_figure-kut .youcetu .youcetu .dt a {
  text-align: center;
}

.main-right .Shuffling_figure-kut .youcetu .dd {
  width: 70px;
  float: right;
  line-height: 25px;
  height: 25px;
  margin-right: 20px;
  background-color: tomato;
}
</style>